<script setup>
  import { RouterView } from 'vue-router'
  import Footer from '../components/Footer.vue';
  import Header from '../components/Header.vue'
  import router from '../router';
</script>

<template>
<div class="layout">
    <el-container class="container">
      <el-aside class="aside">
        <div class="head">
          <div>
            <img src="../assets/logo.png" alt="logo">
            <span>酒店管理平台</span>
          </div>
        </div>
        <div class="line" />
        <el-menu
          background-color="#222832"
          text-color="#fff"
          :router="true"
        >
          <el-sub-menu index="1">
            <template #title>
              <span>酒店管理</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/hotelmanager/index" :class="router.currentRoute.value.fullPath === '/hotelmanager/index' ? 'routerActiveCSS' : 'routerNotActiveCSS'">
                <el-icon><Odometer /></el-icon>
                  首页
              </el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
           <el-sub-menu index="2">
            <template #title>
              <span>星级酒店</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/hotelmanager/swiper" :class="router.currentRoute.value.fullPath === '/hotelmanager/swiper' ? 'routerActiveCSS' : 'routerNotActiveCSS'"><el-icon><House /></el-icon>房间预定管理</el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
          <el-sub-menu index="3">
            <template #title>
              <span>非星级酒店</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/hotelmanager/category" :class="router.currentRoute.value.fullPath === '/hotelmanager/category' ? 'routerActiveCSS' : 'routerNotActiveCSS'"><el-icon><House /></el-icon>房间预定管理</el-menu-item>
            </el-menu-item-group>
          </el-sub-menu>
        </el-menu>
      </el-aside>
      <el-container class="content">
        <Header />
        <div class="main">
          <router-view />
        </div>
        <Footer />
      </el-container>
    </el-container>
  </div>
</template>

<style scoped>
  .routerActiveCSS {
    color: #409eff !important;
  }

  .routerNotActiveCSS{
    color: #fff;
  }

  header {
    line-height: 1.5;
    max-height: 100px;
  }
  
  .logo {
    display: block;
    margin: 0 auto 2rem;
  }
  
  nav {
    width: 100%;
    font-size: 12px;
    text-align: center;
    margin-top: 2rem;
  }
  
  nav a.router-link-exact-active {
    color: var(--color-text);
  }
  
  nav a.router-link-exact-active:hover {
    background-color: transparent;
  }
  
  nav a {
    display: inline-block;
    padding: 0 1rem;
    border-left: 1px solid var(--color-border);
  }
  
  nav a:first-of-type {
    border: 0;
  }
  
  .layout {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background-color: #ffffff;
    width: 100%;
  }
  .container {
    height: 100vh;
    overflow: hidden;
  }
  .aside {
    width: 200px;
    background-color: #222832;
    height: 100%;
    overflow-y: auto;
    -ms-overflow-style: none; /* Edge */
    &::-webkit-scrollbar {
      display: none; /* WebKit */
    }
  }
  /* .side{
    overflow: hidden;
    width: 182px;
  } */
  /* .scroll-hide-div{
    width: max-content;
    overflow: hidden;
    background-color: #222832;
  } */
  .head {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
  }
  .head > div {
    display: flex;
    align-items: center;
  }
  
  .head img {
    width: 50px;
    height: 50px;
    margin-right: 10px;
  }
  .head span {
    font-size: 20px;
    color: #ffffff;
  }
  .line {
    border-top: 1px solid hsla(0,0%,100%,.05);
    border-bottom: 1px solid rgba(0,0,0,.2);
  }
  .content {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    overflow: hidden;
  }
  .main {
    height: 100vh;
    overflow: hidden;
    padding: 100px;
  }
  .header{
    height: 120px;
  }
  </style>
<style>
body {
      padding: 0;
      margin: 0;
      height: 100%  ;
    }
    .el-menu {
      border-right: none!important;
    }
    .el-submenu {
      border-top: 1px solid hsla(0, 0%, 100%, .05);
      border-bottom: 1px solid rgba(0, 0, 0, .2);
    }
    .el-submenu:first-child {
      border-top: none;
    }
    .el-submenu [class^="el-icon-"] {
      vertical-align: -1px!important;
    }
    a {
      color: #409eff;
      text-decoration: none;
    }
    .el-pagination {
      text-align: center;
      margin-top: 20px;
    }
    .el-popper__arrow {
      display: none;
    }    
</style>